﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Market.Model;
using System.Data.SqlClient;

namespace Market.DAL
{
    public class yongta
    {
        Helper SQL = new Helper();
        public UserInfo Login(string name, string pass)
        {
            string sql = string.Format(@"select * from UserInfo 
where UserName='{0}' and UserPass='{1}'", name, pass);

            UserInfo admin = null;
            SqlDataReader dr = SQL.GetReader(sql);
            if (dr.Read())
            {
                admin = new UserInfo();
                admin.UserNo = Convert.ToInt32(dr["UserNo"]);
                admin.UserName = dr["UserName"].ToString();
                admin.UserPass = dr["UserPass"].ToString() ;
            }
            dr.Close();
            SQL.Close();

            return admin;
        }
    }
}
